#ifndef MAINCONTROLLER_H
#define MAINCONTROLLER_H

#include "ImageManager.h"
#include "ImageProcessorModule.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QtCore>
#include <QMainWindow>
#include <QLabel>

#include "processors/example/ExampleProcessor.h"
#include "processors/negative/NegativeModule.h"
#include "processors/brightness/BrightnessModule.h"
#include "processors/flip/FlipProcessor.h"
#include "processors/bw/BlackWhiteProcessor.h"

class MainController : public QObject
{
    Q_OBJECT

private:
    ImageManager *MainImageManager;
    ImageProcessorModule *CurrentImageProcessorModule;
    QMainWindow * MainApplicationWindow;

    /* Widgets from the main window; their addresses are retrieved when MainController is
      constructed, so we don't have to keep a reference to our MainWindow - it would have
      caused a circular dependency between MainWindow and MainController, because MainWindow needs
      a pointer to the MainController too.
    */
    QFrame * ConfigPanel;
    QLabel * lblWorkingImage;
    QLabel * lblPreviewImage;

    QString OriginalFileName;

    void setCurrentImageProcessorModule(ImageProcessorModule * module);
public:
    MainController(QMainWindow * mw);
    void displayWorkingImage();
    void displayPreviewImage();
    QFrame * getConfigPanel();
    void clearConfigPanel();
public slots:
    void on_actionOpen_triggered();
    void on_actionSave_triggered();
    void on_actionSaveAs_triggered();
    void on_actionQuit_triggered();
    void on_actionAbout_triggered();

    void on_btnReset_clicked();
    void on_btnApply_clicked();
    void on_btnPreviewProcessor_clicked();

    void on_actionExampleProcessor_triggered();
    void on_actionNegative_triggered();
    void on_actionBrightness_triggered();
    void on_actionFlip_triggered();
    void on_actionGrayscale_triggered();
    // ... and all actions that enable an image processor module

public:
    void report_ImageNotLoaded();
};

#endif // MAINCONTROLLER_H
